package com.aabbc.elasticsearch.document;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * DocumentOrder
 *
 * @author: <a href="mailto:chenfenghai@oristartech.com">chenfenghai</a>
 * @version: 1.0
 * @date: 2019-11-26 14:28
 */
@Data
@Document(indexName = "order", type = "docs")
public class OrderDocument {

    @Id
    private Long orderId;

    @Field(type = FieldType.Keyword)
    private String orderCode;

    @Field(type = FieldType.Keyword)
    private String orderType;

    @Field(type = FieldType.Keyword)
    private String orderStatus;

    @Field(type = FieldType.Double)
    private Double orderPrice;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd'T'HH:mm:ss",timezone="GMT+8")
    private Date orderTime;
}
